package com.googlecode.perfectable.persistable.index;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;

import javax.annotation.Nullable;

import com.googlecode.perfectable.persistable.session.Identifier;

public class PrimaryIndex implements Index<Object, Void> {

	private final Collection<Identifier<?>> identifiers = new HashSet<>();

	@Override
	public Collection<Identifier<?>> scan(@Nullable Void property) {
		return Collections.unmodifiableCollection(this.identifiers);
	}

	@Override
	public <K> void insert(K entity, Identifier<? extends K> identity) {
		this.identifiers.add(identity);
	}

}
